Introduction to Medical Statistics 2024
Exercises Class IV
Statistics for the comparison of groups (continuous data)

Author

Nguyen Lam Vuong and the Biostatistics team

Published

August 21, 2024

Exercise i)

We use the dataset cmTbmData.csv. It contains information on 201 patients with meningitis from 4 different patient groups. For this session, we will restrict attention to HIV-positive patients.

  1. Import the dataset and create a new dataset cmTbm.hiv which contains HIV-positive patients only. We also load the ggplot2 package to plot beautiful graphs, and the patchwork package which allows us to easily plot graphs next to each other.
  1. We test whether there a difference in age between HIV-positive patients with cryptococcal meningitis (CM) or tuberculous meningitis (TBM). What should we do?
  1. First, visualise and compare the age distribution in the two groups using a boxplot and a density plot. Do you think it is reasonable to assume that the age distribution is normal in both groups?
  1. Perform a t-test to check the hypothesis that both age distributions are equal. Use the t.test function. You can use the formula specification age~diagnosis as first argument, with the outcome (dependent) variable on the left hand side, and the grouping (independent) variable on the right hand side. Try to understand the output of the t.test function. What do you conclude?

Next, remove the person aged 62 and check whether anything changes.

  1. Test the hypothesis again, now with the Wilcoxon rank-sum test, using the wilcox.test function (here we can use the formula structure as well). What happens if we remove the person aged 62 in the test?
  1. We compare white cell count both in blood (bldwcc) and in CSF (csfwcc) between the two groups, using both the t-test and the Wilcoxon rank-sum test. Are there significant differences between HIV-positive patients with CM or TBM? Do the variables need to be transformed before performing a t-test? If yes, please do so.

Exercise ii)

We use the dataset bmData.csv, containing selected variables from 300 patients with confirmed bacterial meningitis who were randomized to either adjunctive dexamethasone therapy or placebo.

  1. Import the dataset with both treatment groups, check the distribution of CSF total white cell count at baseline and follow-up. Compute the transformed variables if needed.
  1. Test whether the change in value differs from zero in the dexamethasone group, using the paired t-test. Compare the result with the one based on the one-sample t-test for the difference.
  1. Does the change in CSF total white cell counts differ between the two randomized groups?